package view;

import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class ManageUsersView {
    public void showUi() {
        JFrame jf = new JFrame("管理用户");
        jf.setIconImage(Toolkit.getDefaultToolkit().createImage(MainView.class.getResource("qq.jpg")));
        JPanel jp = new JPanel();
        JLabel jl1 = new JLabel("管理用户");
        jl1.setFont(new Font("黑体", Font.BOLD, 24));
        JButton bu2 = new JButton("屏 蔽 用 户");
        JButton bu3 = new JButton("解除屏蔽用户");
        JButton bu4 = new JButton("退      出");
        jp.setLayout(null);
        jl1.setBounds(175, 1, 200, 50);
        bu2.setBounds(150, 100, 150, 50);
        bu3.setBounds(150, 200, 150, 50);
        bu4.setBounds(150, 300, 150, 50);
        jp.add(jl1);
        jp.add(bu2);
        jp.add(bu3);
        jf.add(bu4);
        jf.add(jp);
        jf.setVisible(true);
        jf.setBounds(600, 200, 500, 500);
        bu2.addActionListener(e -> {
            BlockUserView blockUserView = new BlockUserView();
            blockUserView.showUi();
        });
        bu3.addActionListener(e -> {
            UnblockUserView unblockUserView = new UnblockUserView();
            unblockUserView.showUi();
        });
        bu4.addActionListener(e -> jf.dispose());
        jf.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                jf.dispose();
            }
        });
    }
}